<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <!--[if lt IE 9]>
    <script type="text/javascript" src="/admin/lib/html5shiv.js"></script>
    <script type="text/javascript" src="/admin/lib/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="/admin/static/h-ui/css/H-ui.css"/>
    <link rel="stylesheet" type="text/css" href="/admin/static/h-ui.admin/css/H-ui.admin.css"/>
    <link rel="stylesheet" type="text/css" href="/admin/lib/Hui-iconfont/1.0.8/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="/admin/static/h-ui.admin/skin/default/skin.css" id="skin"/>
    <link rel="stylesheet" type="text/css" href="/admin/static/h-ui.admin/css/style.css"/>
    <link rel="stylesheet" type="text/css" href="/admin/lib/datatables/1.10.21/datatables.min.css"/>
    <!--[if IE 6]>
    <script type="text/javascript" src="/admin/lib/DD_belatedPNG_0.0.8a-min.js"></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <title></title>
</head>
<body>
<nav class="breadcrumb">
    <i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 统计分析 <span class="c-gray en">&gt;</span>
    按工器具名称统计
    <a class="btn btn-primary radius r" style="line-height:1.6em;margin-top:3px"
       href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<div class="page-container">
    <a href="" class="btn btn-primary radius" id="toExcel" download="工器具统计表">导出excel</a>
    <form action="" method="post">
        <div class="text-c"> 日期范围：
            <input type="text" onfocus="WdatePicker({ maxDate:'#F{$dp.$D(\'datemax\')||\'%y-%M-%d\'}' })"
                   name="date_start" id="datemin"
                   class="input-text Wdate" style="width:120px;" value="{{$date_start}}">
            -
            <input type="text" onfocus="WdatePicker({ minDate:'#F{$dp.$D(\'datemin\')}',maxDate:'%y-%M-%d' })"
                   id="datemax"
                   name="date_end" class="input-text Wdate" style="width:120px;" value="{{$date_end}}">
            @csrf
            <button type="submit" class="btn btn-success radius">
                <i class="Hui-iconfont">&#xe665;</i> 查询
            </button>
        </div>
    </form>
    <div class="mt-20">
        <table class="table table-border table-bordered table-hover table-bg table-responsive" id="datatable">
            <thead>
            <tr>
                <th scope="col" colspan="4">日期范围：{{$date_start}} 至 {{$date_end}}</th>
            </tr>
            <tr class="text-c">
                <th width="25%">安全工器具类型</th>
                <th width="25%">电压等级</th>
                <th width="25%">单位</th>
                <th width="25%">数量</th>
            </tr>
            </thead>
            <tbody>
            @if (empty($data['tbdata']))
                <tr class="text-c">
                    <td colspan="4" style="text-align: left;">记录为空</td>
                </tr>
            @else
                @php $count = count($data['tbdata']); @endphp
                @foreach ($data['tbdata'] as $k => $val)
                    @php $tjcount = count($data['tongji'][$val['name']]); $kj = $k-1; @endphp
                    <tr class="text-c">
                        @if($tjcount>1)
                            @if($count > $k && $val['name'] === array_get($data,"tbdata.{$kj}.name",''))
                            @else
                                <td rowspan="{{$tjcount}}">{{ $val['name'] }}</td>
                            @endif
                        @else
                            @if($tjcount === 1) <td>{{ $val['name'] }}</td> @endif
                        @endif
                        <td>{{ $val['voltage'] }}</td>
                        @if($tjcount>1)
                            @if($count > $k && $val['name'] === array_get($data,"tbdata.{$kj}.name",'') && $val['unit'] === array_get($data,"tbdata.{$kj}.unit",''))
                            @else
                                <td rowspan="{{$tjcount}}">{{ $val['unit'] }}</td>
                            @endif
                        @else
                            @if($tjcount === 1) <td>{{ $val['unit'] }}</td> @endif
                        @endif
                        <td>{{ $val['count'] }}</td>
                    </tr>
                @endforeach
            @endif
            </tbody>
        </table>
    </div>
</div>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="/admin/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="/admin/lib/layer/3.1.1/layer.js"></script>
<script type="text/javascript" src="/admin/static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="/admin/static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->
<script type="text/javascript" src="/admin/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script src="/admin/lib/echarts/echarts-bar.min.js"></script>
<script type="text/javascript" src="/admin/lib/datatables/1.10.21/datatables.min.js"></script>
<script type="text/javascript" src="/admin/static/myfolder/js/statistics/common.js?ver={{config('constant.static_res_ver')}}"></script>
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript">

    $('#datatable').DataTable({
        fixedHeader: true,
        ordering: false, // 是否排序
        paging: false, //禁用分页
        searching: false,
        info: false,
    });
</script>
</body>
</html>
